Skip to content

Swift: Update the new metatype sinks#21905

Merged
geoffw0 merged 1 commit into
github:mainfrom
geoffw0:swiftflow2
May 29, 2026
Merged

Swift: Update the new metatype sinks#21905
geoffw0 merged 1 commit into
github:mainfrom
geoffw0:swiftflow2

Conversation

@geoffw0
Copy link
Copy Markdown
Contributor

@geoffw0 geoffw0 commented May 28, 2026

Update the new metatype sinks to use .getInterfaceType() rather than relying on name matching (".Type").

@jketema this is the best I could do without spending much too long on this. I had a good look at how to generalize this to all Swift MaD sources and sinks - the issue being that interpretElement0 only cares about functions, not calls, so there's no access to the call qualifier as the current solution uses. A wider fix might need to be deeper in the dataflow wiring (perhaps somewhere in DataFlowPrivate.qll).

I do still need to look into the performance regression I saw on the last PR, whether it's real and whether this change makes it better or worse.

@geoffw0 geoffw0 added the Swift label May 28, 2026
Copy link
Copy Markdown
Contributor

@jketema jketema left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. This looks very reasonable.

@jketema
Copy link
Copy Markdown
Contributor

jketema commented May 29, 2026

I do still need to look into the performance regression I saw on the last PR, whether it's real and whether this change makes it better or worse.

Are you sure it's a performance regression and not just the general performance flakiness of the macOS runners?

@geoffw0
Copy link
Copy Markdown
Contributor Author

geoffw0 commented May 29, 2026

I did a repeat run and it does indeed look like flakiness.

@geoffw0 geoffw0 marked this pull request as ready for review May 29, 2026 13:13
Copilot AI review requested due to automatic review settings May 29, 2026 13:13
@geoffw0 geoffw0 requested a review from a team as a code owner May 29, 2026 13:13
@geoffw0 geoffw0 added the no-change-note-required This PR does not need a change note label May 29, 2026
@jketema
Copy link
Copy Markdown
Contributor

jketema commented May 29, 2026

@geoffw0 Note that I already approved

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates Swift weak-hashing security extension sinks to identify metatype qualifiers structurally through TypeDecl.getInterfaceType() rather than by matching ".Type" in type names.

Changes:

  • Reworks CryptoKit metatype sink matching for weak sensitive-data hashing algorithms.
  • Applies the same metatype matching approach for weak password hashing algorithms.
  • Keeps the existing call target and argument matching behavior intact.
Show a summary per file
File Description
swift/ql/lib/codeql/swift/security/WeakSensitiveDataHashingExtensions.qll Updates Insecure.MD5/Insecure.SHA1 metatype sink qualifier matching.
swift/ql/lib/codeql/swift/security/WeakPasswordHashingExtensions.qll Updates SHA256/SHA384/SHA512 metatype sink qualifier matching.

Copilot's findings

  • Files reviewed: 2/2 changed files
  • Comments generated: 0

@geoffw0 geoffw0 merged commit 43c1152 into github:main May 29, 2026
26 of 27 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

no-change-note-required This PR does not need a change note Swift

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants